<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<title>制作12进制的适中特效</title>
	</head>
	<body>
		<div id="myclock">
		<script type="text/javascript">
			
			function clock_12h(){
				var now=new Date();            //获得当前时间
				var year=now.getFullYear();   //获得年份
				var month=now.getMonth();     //获得月份
				var day=now.getDate();         //获得天数
				var week=now.getDay();       //获得星期
				var hours=now.getHours();     //获得小时
				var minutes=now.getMinutes();  //分钟
				var seconds=now.getSeconds();   //获得当前秒数
				var h,w;
				if(hours>12){
					h="PM";
					hours=hours-12;
				}else{
					h="AM";
				}
				
				if(week==0){
					w="星期日";
				}else if(week==1){
					w="星期一";
				}else if(week==2){
					w="星期二";
				}else if(week==3){
					w="星期三";
				}else if(week==4){
					w="星期四";
				}else if(week==5){
					w="星期五";
				}else if(week==6){
					w="星期六";
				}
				
//				switch(week){
//					case "0":w="星期日";break;
//					case "1":w="星期一";break;
//					case "2":w="星期二";break;
//					case "3":w="星期三";break;
//					case "4":w="星期四";break;
//					case "5":w="星期五";break;
//					case "6":w="星期六";break;
//				}
//				
				document.getElementById("myclock").innerHTML="你好，欢迎访问贵美商城！"+"<br/>"+"现在是："
				+year+"年"+(month+1)+"月"+day+"日"+"&nbsp;&nbsp;"+hours+":"+minutes+
				":"+seconds+"&nbsp;&nbsp;"+h+"&nbsp;&nbsp;"+w;
			}
			var mytime=setInterval("clock_12h()",1000);
		</script>
	   </div>
	</body>
</html>
